
import Feature from '../src/views/featurePage/feature.vue'

class ControlRouter{
    constructor(){}
    
    addRouterComp( vm ){
        // vm.$router.options.routes.push(
        //     {
        //       path: '/func',
        //       name: 'functionality',
        //       component: Feature
        //     },) //这样不能渲染页面
        vm.$router.addRoutes([{
              path: '/func',
              name: 'functionality',
              component: Feature 
        }]);
    }

    addRoutingUser( vm ){
        vm.$router.addRoutes([{
              path: '/func',
              name: 'functionality',
              component: Feature 
        }]);
    }

    //检测登录状态
    checkLoginStatus(){
        let token = localStorage.getItem("token");
        console.log("router manager token: ", token );
    }
}


let controlR = {};

controlR.install = function( Vue , options){
    Vue.prototype.$controlRouter = new ControlRouter();
};

export default controlR;
